<template>
	<page-header-wrapper>
		<a-card :bordered="false">
			<div class="table-page-search-wrapper">
				<a-form layout="inline">
					<a-row :gutter="24">
						<a-col :span='4'>
							<a-form-item>
								<a-input placeholder="请输入姓名" v-model="params.name" @input='initData(1)' allowClear/>
							</a-form-item>
						</a-col>
						<a-col :span='4'>
							<a-form-item>
								<a-input placeholder="请输入手机号码" v-model="params.mobile" @input='initData(1)' allowClear/>
							</a-form-item>
						</a-col>
						<span class="table-page-search-submitButtons">
							<a-button type="primary" @click="initData(1)" icon="search">查询</a-button>
						</span>
					</a-row>
				</a-form>
			</div>
			<a-table :dataSource="dataSource" :columns="columns" :pagination="pagination" showPagination="auto" rowKey="id" ref="table" :loading='loading'>
				
			</a-table>
		</a-card>
	</page-header-wrapper>
</template>

<script>
	import {
		lists,
	} from '@/api/partner.js'
	let columns = [
		{title: 'ID',dataIndex: 'id'},
		{title: '姓名',dataIndex: 'name'},
		{title: '手机号码',dataIndex: 'mobile'},
		{title: '城市',dataIndex: 'city'},
		{title: '预算金额',dataIndex: 'budget'},
	];
	export default {
		data(){
			return{
				loading:false,
				columns:[],
				dataSource:[],
				params:{
					name:'',
					mobild:'',
					page:1,
					size:10,
				},
				pagination: {
					// 分页配置
					pageSize: 10, // 每页显示的条数
					showSizeChanger: true, // 是否可以改变每页显示的条数
					pageSizeOptions: ['10', '20', '30', '40'], // 可选的每页显示条数
					showQuickJumper: true, // 是否可以快速跳转到指定页
					showTotal: total => `共 ${total} 条`, // 显示总条数和当前数据范围
					current: 1, // 当前页数
					total: 0, // 总条数
					onShowSizeChange:this.initData,//每页显示数改变的回调
					onChange: this.initData // 页码改变时的回调函数
				},
			}
		},
		created(){
			this.columns = columns;
			this.initData(1);
		},
		methods:{
			initData(page,pageSize){
				this.params.page = page?page:this.params.page;
				this.params.size = pageSize?pageSize:this.params.size;
				lists(this.params).then(res=>{
					this.loading = false;
					if (res.status == '0') {
						this.dataSource = res.data.data;
						this.pagination.total = res.data.totalCount;
					} else {
						this.$message.error(res.msg);
					}
				}).catch(err=>{
					console.log(err);
				})
			}
		}
	}
</script>

<style>
</style>